// javamaps
// Copyright (c) 2010 Lup Gratian
package Rendering.Utils;

public final class Stopwatch {
    private long startTime_;
    private long duration_;

    /*
     * Constructori.
     */
    public Stopwatch(long duration) {
        duration_ = duration;
    }

    /*
     * Metode publice.
     */
    public void Start() {
        startTime_ = System.currentTimeMillis();
    }

    public long Ellapsed() {
        return System.currentTimeMillis() - startTime_;
    }

    public double Progress() {
        return Math.min(1.0, Ellapsed() / (double)duration_);
    }

    public boolean Completed() {
        return Ellapsed() >= duration_;
    }

    public long Duration() { return duration_; }
}